package com.ruoyi.wechat.api;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.wechat.domain.CCamp;
import com.ruoyi.wechat.domain.CCollect;
import com.ruoyi.wechat.service.ICCollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/wechat/collect")
public class WxCollectController extends BaseController {

    @Autowired
    private ICCollectService collectService;
    /**
     * 查询收藏列表
     */
    @GetMapping("/list/{userId}")
    public AjaxResult list(@PathVariable String userId)
    {
        List<CCamp> list = collectService.selectCollectByUserId(userId);
        return success(list);
    }


    /**
     * 点击收藏按钮
     */
    @PostMapping
    public AjaxResult add(@RequestBody CCollect cCollect)
    {
        return success(collectService.insertCCollect(cCollect));
    }

}
